package com.zyit.service;

import com.google.gson.Gson;
import com.zyit.DataObject.T_classify;
import com.zyit.service.Impl.ClassifyServiceImpl;


import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.util.List;

@WebServlet("/contendisplaytwo")
public class ContendisplayServiceTwo extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse response) {

        ClassifyService classifyService = new ClassifyServiceImpl();


        try {

            List<T_classify> typeClassify = classifyService.findClassify();

            response.setContentType("application/json");
            response.setCharacterEncoding("UTF-8");
            String json = new Gson().toJson(typeClassify);
            System.out.println(json);
            response.getWriter().write(json);

        } catch (Exception e) {
            throw new RuntimeException(e);
        }


    }

}
